package ywh.list
{
	import ywh.manager.Tag;
	import ywh.manager.Tag;
	import ywh.utils.TimeFormat;
	import ywh.utils.XMLUtils;
	
	/**
	 * 主类列表;
	 * @author 杨伟华
	 * @version 2.0
	 *
	 * Created 1/21/2013 1:49 AM
	 */
	public class MainList extends MediaList
	{
	
		static private var _$:MainList;
		
		public function MainList(p:PrivateClass)
		{
			super();
			if (!p || _$)
			{
				throw(new Error("MainList是一个单例类，请调用MainList.$"));
			}
			else
			{
				_$ = this;
			}
		}
		
		static public function get $():MainList
		{
			return _$ || new MainList(new PrivateClass());
		}
		
		override protected function parseXML(xml:XML):Boolean
		{
			var duration:Number = TimeFormat.hhmmss2ss(XMLUtils.getPropString(xml,Tag._DURATION));
			if (duration)
			{
				xml[Tag._M] = String(count);
				xml[Tag._T] = "0";
				xml[Tag._START_TIME] = String(_totalDuration);
				_courseItems.push(xml);
				_totalDuration += duration;
				return true;
			}
			return false;
		}
	}
}

class PrivateClass
{
}